package Administrator.AdministratorMainFrame.AdministratorMainFrameModel;

import Packet.*;
import java.io.*;
import java.net.*;
import Administrator.AdministratorMainFrame.AdministratorMainFrameModel.*;

public class AdministratorThread extends Thread
{
    public AdministratorThread(Socket socket, AdministratorMainFrameModel model)
    {
    	this.socket = socket;
    	this.model = model;
    }
    
    public void initialize()
    {
    	try
    	{
    		this.objectInputStream = new ObjectInputStream(this.socket.getInputStream());
    		this.objectOutputStream = new ObjectOutputStream(this.socket.getOutputStream());
    	}
    	catch(IOException exception)
    	{
    	    exception.printStackTrace();	
    	}
    }
    
    public ObjectInputStream getInputStream()
    {
    	return this.objectInputStream;
    }
    
    public ObjectOutputStream getOutputStream()
    {
    	return this.objectOutputStream;
    }
    
    public AdministratorMainFrameModel getModel()
    {
    	return this.model;
    }
    
    public void dealPacket(Packet packet)
    {
    	
    }
    
    public void run()
    {
    	ReceivePacketThread receivePacketThread = new ReceivePacketThread(this);
    	receivePacketThread.start();
    }
    
    private Socket socket;
    private AdministratorMainFrameModel model;
    
    private ObjectInputStream objectInputStream;
    private ObjectOutputStream objectOutputStream;
}
